package com.lcfc.attend.service;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.lcfc.attend.entity.vo.DailyAttendanceVo;
import com.lcfc.attend.entity.vo.EmpDetailVo;
import com.lcfc.attend.entity.vo.ProjectEmpVo;
import com.lcfc.attend.mapper.DailyAttendanceMapper;
import com.lcfc.attend.mapper.ProjectEmpMapper;
import com.mysql.jdbc.StringUtils;

@Service
public class ProjectEmpService {

	@Autowired
	private ProjectEmpMapper projectEmpMapper;
	@Autowired
	private DailyAttendanceMapper dailyAttendanceMapper;
	/**
	 * 安检人员列表
	 * @param officeCodes
	 * @param dateFlag 
	 * @return
	 */
	public List<ProjectEmpVo> queryEmpList(String officeCodes, String dateFlag) {
		if (!StringUtils.isNullOrEmpty(officeCodes)) {
			String[] codes = officeCodes.split(",");
			String str = "";
			for (String office : codes) {
				str += "'" + office + "'" + ",";
			}
			officeCodes = str.substring(0, str.length() - 1);
		}
		List<ProjectEmpVo> list = projectEmpMapper.queryEmpList(officeCodes,dateFlag);
		return list;
	}
	/**
	 * 安检人员详情
	 * @param empId
	 * @param dateFlag 
	 * @return
	 */
	public EmpDetailVo queryEmpDetail(String empId) {
		EmpDetailVo detailVo = projectEmpMapper.queryEmpDetail(empId);
		return detailVo;
	}
	/**
	 * 人员打卡记录
	 * @param empId
	 * @param dateFlag
	 * @return
	 */
	public List<DailyAttendanceVo> queryDailyList(String empId, String dateFlag) {
		List<DailyAttendanceVo> list = dailyAttendanceMapper.queryDailyList(empId,dateFlag);
		return list;
	}
}
